package com.ltf.order;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;

/**
 * @Auther: liutf
 * @Date: 2025/4/2
 * @Description: com.ltf.order
 * @version: 1.0
 */
public class DeclareDemo {
    public static void main(String[] args) throws InvocationTargetException, InstantiationException, IllegalAccessException {
        Class clazz = Person.class;
        Constructor<?>[] publicConstructors = clazz.getConstructors();
        for (Constructor<?> constructor : publicConstructors) {
            Object[] arg = new Object[2];
            arg[0] = "刘肥子";
            arg[1] = 100;
            Object obj = constructor.newInstance(arg);
            System.out.println(obj);
        }
    }
}

@Data
class Person{
    private String name;
    private int age;
    private String address;

    public Person(String name,int age) {
        this.name = name;
        this.age = age;
    }
}